package com.itheima.mapper;


import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckItemDao {




    void addCheckItem(CheckItem checkItem);

    @Delete("DELETE FROM t_checkitem WHERE id = #{id}")
    void deleteCheckItem(Integer id);


    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id = #{id}")
    List<Integer> findCheckItemIdsByCheckGroupId(Integer id);

    void editCheckItem(CheckItem checkItem);

    List<CheckItem> findPage(int start, int end, String queryString);

    @Select("SELECT COUNT(*) FROM t_checkitem")
    Long findCount();

    @Select("SELECT * FROM t_checkitem")
    List<CheckItem> findAll();

    @Select("SELECT * FROM t_checkitem WHERE id = #{id}")
    CheckItem findById(Integer id);

    @Select("SELECT * FROM t_checkitem WHERE code = #{code}")
    CheckItem findByCode(String code);

    @Delete("DELETE FROM t_checkgroup_checkitem WHERE checkitem_id = #{id}")
    void deleteCheckGroupAndCheckItem(Integer id);
}
